/**
 * @version 1.8
 * @Author Djx_hmbb
 * @Date 2023/8/9 15:56
 * @注释:中断
 */
public class ThreadDemo7 {
    private static boolean flag = true;

    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            while (flag) {
                System.out.println("hello thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        t.start();
//        t.isInterrupted();
        Thread.sleep(3000);
        flag = false;
    }
}
